import org.junit.Test;

import java.sql.*;

public class TestSe {

    @Test
    public void test01() {
        Connection connection = null ;
        Statement statement = null ;
        ResultSet set = null ;
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            connection = DriverManager.getConnection
                    ("jdbc:mysql://192.168.43.78:3306/test","root","1234");
            statement = connection.createStatement();
            String sql = "select * from crud";
            set = statement.executeQuery(sql);
            while (set.next()) {
                System.out.println(set.getInt("id"));
            }
        }catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                connection.close();
                statement.close();
                set.close();
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
